
let TEMPLATE = `
<el-menu router :default-openeds="['1']" :unique-opened=true>
    <el-submenu index="1">
        <template slot="title"><i class="el-icon-goods"></i>xpm</template>
        <el-menu-item-group>
        <template slot="title">:3</template>
            <el-menu-item v-for="(cellinfo, index) in xpm_menuitems" :key="index" :index="cellinfo.idx" v-on:click="test(cellinfo.idx)">{{cellinfo.name}}</el-menu-item>
        </el-menu-item-group>
    </el-submenu>
    <el-submenu index="2">
        <template slot="title"><i class="el-icon-mobile-phone"></i>dev</template>
        <el-menu-item-group>
        <el-menu-item v-for="(cellinfo, index) in dev_menuitems" :key="index" :index="cellinfo.idx" v-on:click="test(cellinfo.idx)">{{cellinfo.name}}</el-menu-item>
        </el-menu-item-group>
    </el-submenu>
</el-menu>
`
export default {
    name: "slider_menu",
    template: TEMPLATE,
    data: function () {
        return {
            xpm_menuitems: [
                { idx: '/desc', name: '描述' },
                { idx: '/toolslist', name: '下载' },
                { idx: '/pluginlist', name: 'plugin列表' },
            ],
            dev_menuitems:[
                {idx: "/devbins", name:"测试包"}
            ]

        }
    },
    methods: {
        test(idx) {
            console.log("choose idx--->>", idx);
        },

        ...Vuex.mapActions("xpm", [
            "selectItem"
        ])
    },
    computed: {
        ...Vuex.mapState({
            itemkey: state => state.xpm.itemkey
        }),
    },
}